﻿@model IEnumerable<ProjectManagement.Domain.Entities.Company>

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>单位列表</title>
<script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.22.min.js" type="text/javascript"></script>
<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
	<script src="../../Scripts/flexigrid.js" type="text/javascript"></script>
	<link href="../../Content/flexigrid.css" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
	var message="@TempData["Message"]";
		if(message)
		{
			alert(message);
		};
$(function() {
	$( "a, button", ".content" ).button();
});
$(function() {
		$( "#company_BuildDate" ).datepicker({
			showMonthAfterYear: true,
			changeMonth: true, 
			changeYear: true,
			buttonImageOnly: true,
			minDate: '-1y', maxDate: '+2y',
			dateFormat: 'yy-mm-dd',
		});
	});

$(function () {
	$('#add').click(function(){
		
	});
});
/*地市级联*/
	$(function () {
		$("#company_Province_ID").change(function () {
			var sto = $(this).find("option:selected").val();
			if (sto == "") {
				$('#company_Province_ID').val(0);
				$('#Company_City_ID').val(0);
			}
			else {
				$.ajax({
					url: 'GetSelectedList',
					type: 'Post',
					data: { id: sto },
					success: function (result) {
						$('#Company_City_ID').empty();
						$.each(result, function (i) {
							$("#Company_City_ID").append("<option value='" + result[i]["ID"] + "'>" + result[i]["Name"] + "</option>");
						});
					}
				});
			}
		});
	})
//flexigrid
$(document).ready(function () {
		$('#companies').flexigrid({
			url:'Companylists',
			dataType: 'json',
			colModel: [
				{ display: '编号', name: 'ID', width: 40, sortable: true, align: 'left' },
				{ display: '企业名称', name: 'CompanyName', width: 100, sortable: true, align: 'left' },
				{ display: '单位类型', name: 'CustomType', width: 100, sortable: true, align: 'left' },
				{ display: '行业类别', name: 'IndustryType', width: 100, sortable: true, align: 'left' },
				{ display: '地址', name: 'Address', width: 100, sortable: true, align: 'left' },
				{ display: '注册资金', name: 'RegMoney', width: 80, sortable: true, align: 'left' },
				{ display: '企业描述', name: 'CompanyDes', width: 60, sortable: true, align: 'left' },
				{ display: '单位主页', name: 'HomePage', width: 80, sortable: true, align: 'left' },
				{ display: '企业描述', name: 'CompanyDes', width: 80, sortable: true, align: 'left' },
			],
			buttons: [
			{ name: '添加', bclass: 'add', onpress: button },
			{ name: '修改', bclass: 'edit', onpress: button },
			{ name: '删除', bclass: 'delete', onpress: button },
			{name:'导出Excel',bclass:'excel',onpress:button},
			{ separator: true }
			],
			searchitems: [
				{ display: '编号', name: 'ID' },
				{ display: '企业名称', name: 'CompanyName' },
				{ display: '法人代表', name: 'MasterName' },
				{ display: '地址', name: 'Address' },
				{ display: '录入人', name: 'Creator' },
				{ display: '单位主页', name: 'HomePage' }
			],
			sortname: 'ID',
			sortorder: 'asc',
			usepager: true,
			title: '单位列表',
			useRp: true,
			rp: 15,
			showTableToggleBtn: true,
			width: 1040,
			height: 380,
			checkbox:true,
			rowId:'ID'
			});
	})
</script>
</head>
<body>
<div class="content">
<table id="companies" style="display:none"></table>
</div>
<div class="demo" style="display:none">
	<div id="dialog-message" title="新增单位" >
		@using ProjectManagement.Domain.Entities;
		@{
			var company=new Company();
			var contactor = new CompanyContacts();
		}
		@using (Html.BeginForm("AddCompany","Company",FormMethod.Post)) {
		<h3>基本信息</h3>
		@Html.ValidationSummary(true)
		<table>
			<tr>
					<td>@Html.LabelFor(model => company.CompanyName)</td>
					<td>@Html.EditorFor(model => company.CompanyName)<td>
					<td>@Html.LabelFor(model => company.CompanyProperty)</td>
					<td>@Html.EditorFor(model=>company.CompanyProperty)</td>
			</tr>
			<tr>
					<td>@Html.LabelFor(model => company.CustomClassType)</td>
					<td>@Html.EditorFor(model => company.CustomClassType)</td>
					<td>@Html.LabelFor(model => company.CustomType)</td>
					<td>@Html.EditorFor(model => company.CustomType)</td>
			</tr>
			<tr>
					<td>@Html.LabelFor(model => company.BuildDate)</td>
					<td>@Html.EditorFor(model => company.BuildDate,DateTime.Now)</td>
					<td>@Html.LabelFor(model => company.EmployeeCount)</td>
					<td>@Html.EditorFor(model => company.EmployeeCount)</td>
			</tr>
			<tr>
					<td>@Html.LabelFor(model => company.Province)</td>
					<td>@Html.DropDownListFor(model => company.Province.ID, Html.ProvienceHelper())</td>
					<td>@Html.LabelFor(model => company.City)</td>
					<td>
						<select id="Company_City_ID" name="City">
							<option value="0">请选择</option>
						</select>
					</td>
			</tr>
			<tr>
					<td>@Html.LabelFor(model => company.Address)</td>
					<td>@Html.EditorFor(model => company.Address)</td>
					<td>@Html.LabelFor(model => company.HomePage)</td>
					<td>@Html.EditorFor(model => company.HomePage)</td>
			</tr>
			<tr>
					<td>@Html.LabelFor(model => company.CompanyDes)</td>
					<td colspan="3">@Html.EditorFor(model => company.CompanyDes)</td>
			</tr>
			<tr>
				@Html.HiddenFor(model => company.ID)
				@Html.HiddenFor(model => company.ContactSum)
				@Html.HiddenFor(model => company.Editor)
				@Html.HiddenFor(model => company.EditTime)
			</tr>
		</table>
		}
	</div>
</div>

</body>
</html>
